package org.example.backend.demos.web.result;

import lombok.Getter;


public enum ResultCode {

    // HTTP状态
    SUCCESS(200, "操作成功"),
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "方法不允许"),
    FAILURE(406, "失败"),

    // 业务状态
    USER_NOT_FOUND(601, "用户不存在"),

    PERMISSION_DENIED(603, "权限不足"),
    DATA_VALIDATION_FAILED(604, "数据验证失败"),
    REPEATED_REQUEST(605, "重复请求"),
    SERVICE_UNAVAILABLE(606, "服务不可用"),
    // 令牌状态
    INVALID_TOKEN(602, "无效令牌"),
    EXPIRED_TOKEN(607, "过期令牌"),
    MISSING_TOKEN(608, "缺失令牌"),
    VALID_TOKEN(609,"有效令牌");

    @Getter
    private final int code;
    @Getter
    private final String msg;


    ResultCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

}
